package com.smartrobot.smartrobot.view;

import android.content.Context;
import android.widget.Toast;

/**
 * 避免Toast连续显示
 *
 */
public class ToastCustom {
	
	private static Toast toast;
	
	public static void showToast(Context context,String text){
		
		
		if(toast == null){
			toast = Toast.makeText(context, text, Toast.LENGTH_SHORT);
		}else
		{
			toast.setText(text);
			toast.setDuration(Toast.LENGTH_SHORT);
		}
		
		toast.show();
		
	}
	
	public static void cancelToast(){
		
		if(toast != null)
			toast.cancel();
		
	}
	
	

}
